<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="com.demo.main.utils.CommonUtil" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="zh-CN">
<head>
    <title><%=CommonUtil.PROJECT_NAME%>-管理员图书管理</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no">
    <link rel="stylesheet"
          href="${pageContext.request.contextPath}/lib/bootstrap-5.3.0-alpha1-dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/global.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/main.css">
    <script src="${pageContext.request.contextPath}/lib/bootstrap-5.3.0-alpha1-dist/js/bootstrap.bundle.min.js"></script>
    <script src="${pageContext.request.contextPath}/lib/jquery-3.5.1.min.js"></script>
    <style>
        .sidebar {
            height: calc(100vh - 56px);
            position: fixed;
            top: 56px;
            left: 0;
            width: 250px;
            overflow-y: auto;
        }

        .main-content {
            margin-left: 250px;
            padding: 20px;
            height: calc(100vh - 56px);
            overflow-y: auto;
        }

        .navbar-brand {
            margin-left: 100px;
            display: flex;
            align-items: center;
        }

        .navbar-brand svg {
            width: 40px;
            height: 40px;
            margin-right: 10px;
        }

        .navbar-brand span {
            font-size: 1.4rem;
            line-height: 1;
        }
    </style>
</head>

<%

%>
<body>
<!-- 定义一个导航栏，使用Bootstrap框架的样式类 -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
    <!-- 容器，用于包裹导航栏内容 -->
    <div class="container-fluid">
        <!-- 导航栏品牌链接，点击后跳转到首页 -->
        <a class="navbar-brand navbar-logo" href="#">
            <!-- SVG图标，用于显示公司或项目的标志 -->
            <svg class="logo" width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
                <!-- 绘制一个自定义形状的路径，作为标志的一部分 -->
                <path d="M10,5 L30,5 L35,10 L35,35 L5,35 L5,10 L10,5" fill="none" stroke="#1E88E5" stroke-width="2"/>
                <!-- 绘制另一个路径，形成标志的另一部分 -->
                <path d="M10,5 L10,10 L5,10" fill="none" stroke="#1E88E5" stroke-width="2"/>
                <!-- 绘制几条水平线，形成标志的底部部分 -->
                <path d="M12,15 L28,15 M12,20 L28,20 M12,25 L28,25 M12,30 L28,30" stroke="#1E88E5" stroke-width="1.5"/>
            </svg>
            <!-- 显示项目名称，从应用范围变量中获取 -->
            <span>${applicationScope.PROJECT_NAME}</span>
        </a>
    </div>
</nav>

<!-- 侧边栏 -->
<div class="sidebar bg-light pt-3">
    <ul class="nav flex-column">
        <li class="nav-item">
            <a class="nav-link" href="order?action=admin_order_view">订单查看</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" href="order?action=admin_order_delete">订单删除</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" href="../views/user?action=admin_user_view">用户查看</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" href="../views/user?action=admin_password_edit">密码修改</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" href="login?action=logout">退出登录</a>
        </li>
    </ul>
</div>

<!-- 主体部分 -->
<div class="main-content">
    <h2 class="mb-4">订单查询</h2>

    <!-- 查询表单 -->
    <form class="mb-4" method="get" action="order">
        <input type="hidden" name="action" value="admin_order_view_condition">
        <div class="row g-3">
            <div class="col-md-3">
                <label for="totalAmount" class="form-label">订单金额</label>
                <input type="number" class="form-control" id="totalAmount" name="totalAmount" step="0.01">
            </div>
            <div class="col-md-3">
                <label for="paymentMethod" class="form-label">支付方式</label>
                <select class="form-select" id="paymentMethod" name="paymentMethod">
                    <option value="">全部</option>
                    <option value="现金">现金</option>
                    <option value="信用卡">信用卡</option>
                    <option value="在线支付">在线支付</option>
                </select>
            </div>
            <div class="col-md-3">
                <label for="orderStatus" class="form-label">订单状态</label>
                <select class="form-select" id="orderStatus" name="orderStatus">
                    <option value="">全部</option>
                    <option value="待处理">待处理</option>
                    <option value="已付款">已完成</option>
                </select>
            </div>
            <div class="col-md-3">
                <label for="orderDate" class="form-label">订单日期</label>
                <input type="datetime-local" class="form-control" id="orderDate" name="orderDate">
            </div>
        </div>
        <div class="mt-3">
            <button type="submit" class="btn btn-primary">查询</button>
            <button type="reset" class="btn btn-secondary">重置</button>
        </div>
    </form>

    <!-- 订单表格 -->
    <table class="table table-striped table-hover">
        <thead>
        <tr>
            <th>图书ID</th>
            <th>书名</th>
            <th>作者</th>
            <th>出版社</th>
            <th>出版日期</th>
            <th>ISBN</th>
            <th>分类号</th>
            <th>类别ID</th>
            <th>总副本数</th>
            <th>可用副本数</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach var="item" items="${list}">
            <tr>
                <td>${item.bookId}</td>
                <td>${item.title}</td>
                <td>${item.author}</td>
                <td>${item.publisher}</td>
                <td>${item.publishDate}</td>
                <td>${item.isbn}</td>
                <td>${item.classificationNumber}</td>
                <td>${item.categoryId}</td>
                <td>${item.totalCopies}</td>
                <td>${item.availableCopies}</td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>
<jsp:include page="/footer"/>
<script src="${pageContext.request.contextPath}/lib/bootstrap-5.3.0-alpha1-dist/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/lib/bootstrap-5.3.0-alpha1-dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>